package com.tarena.lbs.coupon.dao.repository.impl;

import com.tarena.lbs.coupon.dao.mapper.CouponCodeMapper;
import com.tarena.lbs.coupon.dao.repository.CouponCodeRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Slf4j
@Repository
public class CouponCodeRepositoryImpl implements CouponCodeRepository {
    @Autowired
    private CouponCodeMapper couponCodeMapper;

    @Override
    public void addStock(Integer couponId, Integer maxUsageLimit) {
        log.debug("新增库存成功: {}", couponId);
        couponCodeMapper.addStock(couponId, maxUsageLimit);
    }

    @Override
    public void updateStock(Integer couponId, Integer maxUsageLimit) {
        couponCodeMapper.updateStock(couponId, maxUsageLimit);
        log.debug("更新库存成功: {}", couponId);
    }

    @Override
    public void addCouponCode(Integer couponId, Integer count) {
        // 实现添加优惠券码的逻辑
        couponCodeMapper.addCouponCode(couponId, count);
        log.debug("添加优惠券码成功: couponId={}, count={}", couponId, count);
    }
}
